﻿using System;
using System.Windows.Forms;
using Server.Manager;

namespace The_World_Server
{
    public partial class frmServer : Form
    {
        public frmServer()
        {
            InitializeComponent();
        }

        // Used for TextAddting text
        public static int NumLines = -1;

        public void TextAdd(string text)
        {
            NumLines = NumLines + 1;

            if (NumLines >= 100)
            {
                txtLog.Text = String.Empty;
                NumLines = 0;
            }

            txtLog.Text = txtLog.Text + Environment.NewLine + text;
            txtLog.SelectionStart = txtLog.Text.Length;
            txtLog.ScrollToCaret();
        }

        private void frmServer_FormClosing(object sender, FormClosingEventArgs e)
        {
            Loop.Instance.isServerRunning = false;
            GC.Collect();
            Application.Exit();
            //this.Close();
        }
    }
}
